#include <stdio.h>
//
// Created by win10 on 2025/1/3.
//
int main() {
    int n;
    scanf("%d", &n);
    int arr[n],temp;
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }
    for (int i = 1; i < n; i++) {
        temp = arr[i];
        int j = i - 1;
        while (j>=0 && arr[j] > temp) {
            arr[j+1] = arr[j];
            j--;
        }
        arr[j+1] = temp;
        for(int k = 0; k < n; k++) {
            printf("%d%s",arr[k], k==n-1?"":" ");
        }
        printf("\n");
    }
}